package tree;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

/*
 * Raiderz Talent Tree by Avenaei(Andrew)
 */
public class Alltrees {
	
	static JFrame frame;
	static Sintree sin = new Sintree();
	static Deftree def = new Deftree();
	static Clertree cler = new Clertree();
	static Sorctree sorc = new Sorctree();
	static Zerktree zerk = new Zerktree();
	static JPanel clertree;
	static JPanel sintree;
	static JPanel deftree;
	static JPanel sorctree;
	static JPanel zerktree;
	
	public static void resetsin() {
		sin = new Sintree();
		sintree = sin.createContentPane();
		frame.setContentPane(sin.createContentPane());
        frame.setVisible(true);
        sin.updatesin();
        sin.recentset();
	}
	
	public static void resetdef() {
		def = new Deftree();
		deftree = def.createContentPane();
		frame.setContentPane(deftree);
        frame.setVisible(true);
        def.updatedef();
        def.recentset();
	}
	
	public static void resetcler() {
		cler = new Clertree();
		clertree = cler.createContentPane();
		frame.setContentPane(clertree);
        frame.setVisible(true);
        cler.updatecler();
        cler.recentset();
	}
	
	public static void resetsorc() {
		sorc = new Sorctree();
		sorctree = sorc.createContentPane();
		frame.setContentPane(sorctree);
        frame.setVisible(true);
        sorc.updatesorc();
        sorc.recentset();
	}
	
	public static void resetzerk() {
		zerk = new Zerktree();
		zerktree = zerk.createContentPane();
		frame.setContentPane(zerktree);
        frame.setVisible(true);
        zerk.updatezerk();
        zerk.recentset();
	}

	public static void switchsin() {
		//frame.getContentPane().removeAll();
		frame.setContentPane(sintree);
        frame.setVisible(true);
        sin.updatesin();
		
	}
	
	public static void switchdef() {
		//frame.getContentPane().removeAll();
		frame.setContentPane(deftree);
        frame.setVisible(true);
        def.updatedef();
		
	}
	
	public static void switchcler() {
		//frame.getContentPane().removeAll();
		frame.setContentPane(clertree);
        frame.setVisible(true);
        cler.updatecler();
		
	}
	
	public static void switchsorc() {
		//frame.getContentPane().removeAll();
		frame.setContentPane(sorctree);
        frame.setVisible(true);
        sorc.updatesorc();
		
	}
	
	public static void switchzerk() {
		//frame.getContentPane().removeAll();
		frame.setContentPane(zerktree);
        frame.setVisible(true);
        zerk.updatezerk();
		
	}
	
	public static void resetall() {
		sin = new Sintree();
		sintree = sin.createContentPane();
		def = new Deftree();
		deftree = def.createContentPane();
		cler = new Clertree();
		clertree = cler.createContentPane();
		sorc = new Sorctree();
		sorctree = sorc.createContentPane();
		zerk = new Zerktree();
		zerktree = zerk.createContentPane();
		frame.setContentPane(deftree);
        frame.setVisible(true);
		
	}
	
	//this is good

	private static void createAndShowGUI() {
		
		
		
		sintree = sin.createContentPane();
		deftree = def.createContentPane();
		clertree = cler.createContentPane();
		sorctree = sorc.createContentPane();
		zerktree = zerk.createContentPane();

        JFrame.setDefaultLookAndFeelDecorated(true);
        sin.updatesin();
        def.updatedef();
        cler.updatecler();
        sorc.updatesorc();
        zerk.updatezerk();
        frame = new JFrame("Raiderz Skill Tree Calculator by Avenaei(Andrew)");

        //Create and set up the content pane.
        
        frame.setContentPane(deftree);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(560, 600);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setLocation((dim.width/2)-(frame.getSize().width/2), dim.height/2-frame.getSize().height/2);
        frame.setVisible(true);
        JOptionPane.showMessageDialog (null, "Assassin and Defender Skill Descriptions by Avenaei\n" +
        		"Sorcerer and Berserker Descriptions by abaddonxk\n" +
        		"Cleric Descriptions by oroness\n" +
        		"All descriptions have been checked by Avenaei",
        			"Credits", JOptionPane.INFORMATION_MESSAGE);
    }
	public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
            	
                createAndShowGUI();
            }
        });
    }

}
